<?php echo $this->Partial('index/tpl/header.phtml', array(
	'cssList' =>'/my/my.css'		
))?>
<?php 
	echo $this->Partial('my/tpl/nav.phtml', array('cpage'=>'account'));
	$cuser = $this->v['cuser'];
	echo $this->Partial('my/account/tpl/nav.phtml', array('cpage' => 'avatar'));
?>
<style>
.avatar{width:700px;height:440px;}
</style>
<h2 class="title">修改头像</h2>
<div class="avatar">
	<span id="cropAvatar"></span>
</div>
<form method="post" action="/my/account/_avatar" style="display:none" id="formAvatar">
	<input type="hidden" name="avatar" value=""/>
	<input type="submit" value="保存">
</form>

<script src="<?php echo $this->StaticUrl('/static/js/hapj.image.js')?>"></script>
<script src="<?php echo $this->StaticUrl('/static/js/swfupload.js')?>"></script>
<script>
	var formAvatar = hapj.ui.id('formAvatar');
	var rules = ['size120','size60'];
	hapj.com('upload').active('cropAvatar', rules, 'crop', false, {
		picUrl: '<?=$this->Picture($this->v['cuser']['avatar'])?>'
	}).setCallback(function(data){
		formAvatar[0].avatar.value = data.images.orig.id;
		formAvatar.fire('submit');
	});
	hapj.com('verify').active(formAvatar, {
		ok:function(){
			hapj.ui.dialog.ok('修改成功', function(){location.reload();})
		}
	});
</script>
<?php echo $this->Partial('index/tpl/footer.phtml')?>